package abs.service;

import abs.domain.Companias;
import abs.domain.GrupoProveedores;
import abs.domain.Proveedores;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/absWeb-security-context.xml",
		"file:./resources/absWeb-service-context.xml",
		"file:./resources/absWeb-dao-context.xml",
		"file:./resources/absWeb-web-context.xml" })
@Transactional
public class GrupoProveedoresServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected GrupoProveedoresService service;

	/**
	 * Instantiates a new GrupoProveedoresServiceTest.
	 *
	 */
	public GrupoProveedoresServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Save an existing GrupoProveedores entity
	 * 
	 */
	@Test
	public void saveGrupoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoProveedores 
		GrupoProveedores grupoproveedores = new abs.domain.GrupoProveedores();
		service.saveGrupoProveedores(grupoproveedores);
	}

	/**
	 * Operation Unit Test
	 * Return all GrupoProveedores entity
	 * 
	 */
	@Test
	public void findAllGrupoProveedoress() {
		// TODO: JUnit - Populate test inputs for operation: findAllGrupoProveedoress 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<GrupoProveedores> response = null;
		response = service.findAllGrupoProveedoress(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllGrupoProveedoress
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Companias entity
	 * 
	 */
	@Test
	public void deleteGrupoProveedoresCompanias() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoProveedoresCompanias 
		String grupoproveedores_grppr100cdgo = null;
		String related_companias_co000nocia = null;
		GrupoProveedores response = null;
		response = service.deleteGrupoProveedoresCompanias(grupoproveedores_grppr100cdgo, related_companias_co000nocia);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteGrupoProveedoresCompanias
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findGrupoProveedoresByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findGrupoProveedoresByPrimaryKey 
		String grppr100cdgo = null;
		GrupoProveedores response = null;
		response = service.findGrupoProveedoresByPrimaryKey(grppr100cdgo);
		// TODO: JUnit - Add assertions to test outputs of operation: findGrupoProveedoresByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Proveedores entity
	 * 
	 */
	@Test
	public void deleteGrupoProveedoresProveedoreses() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoProveedoresProveedoreses 
		String grupoproveedores_grppr100cdgo_1 = null;
		Integer related_proveedoreses_pr100copr = 0;
		GrupoProveedores response = null;
		response = service.deleteGrupoProveedoresProveedoreses(grupoproveedores_grppr100cdgo_1, related_proveedoreses_pr100copr);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteGrupoProveedoresProveedoreses
	}

	/**
	 * Operation Unit Test
	 * Load an existing GrupoProveedores entity
	 * 
	 */
	@Test
	public void loadGrupoProveedoress() {
		Set<GrupoProveedores> response = null;
		response = service.loadGrupoProveedoress();
		// TODO: JUnit - Add assertions to test outputs of operation: loadGrupoProveedoress
	}

	/**
	 * Operation Unit Test
	 * Return a count of all GrupoProveedores entity
	 * 
	 */
	@Test
	public void countGrupoProveedoress() {
		Integer response = null;
		response = service.countGrupoProveedoress();
		// TODO: JUnit - Add assertions to test outputs of operation: countGrupoProveedoress
	}

	/**
	 * Operation Unit Test
	 * Save an existing Proveedores entity
	 * 
	 */
	@Test
	public void saveGrupoProveedoresProveedoreses() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoProveedoresProveedoreses 
		String grppr100cdgo_1 = null;
		Proveedores related_proveedoreses = new abs.domain.Proveedores();
		GrupoProveedores response = null;
		response = service.saveGrupoProveedoresProveedoreses(grppr100cdgo_1, related_proveedoreses);
		// TODO: JUnit - Add assertions to test outputs of operation: saveGrupoProveedoresProveedoreses
	}

	/**
	 * Operation Unit Test
	 * Delete an existing GrupoProveedores entity
	 * 
	 */
	@Test
	public void deleteGrupoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: deleteGrupoProveedores 
		GrupoProveedores grupoproveedores_1 = new abs.domain.GrupoProveedores();
		service.deleteGrupoProveedores(grupoproveedores_1);
	}

	/**
	 * Operation Unit Test
	 * Save an existing Companias entity
	 * 
	 */
	@Test
	public void saveGrupoProveedoresCompanias() {
		// TODO: JUnit - Populate test inputs for operation: saveGrupoProveedoresCompanias 
		String grppr100cdgo_2 = null;
		Companias related_companias = new abs.domain.Companias();
		GrupoProveedores response = null;
		response = service.saveGrupoProveedoresCompanias(grppr100cdgo_2, related_companias);
		// TODO: JUnit - Add assertions to test outputs of operation: saveGrupoProveedoresCompanias
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
